 import {getTeacherDetail,getSeriesList} from '../../../api/teacher'
 Component({
  data:{
    postData:{
    userId:0,
    pageNum:1,
    pageSize:10
    },
    teacherInfo:{},
    teacherCourseList:[]
  },
  methods:{
    onLoad(data:any){
     const {instructorId}  = data
     const postData = {...this.data.postData,userId:instructorId}
     this.setData({
      postData
     })
     this.getTeacherDetail()
     this.teacherCourseList()
    },
    // 获取教师详情信息
    async getTeacherDetail() {
    const {code,data:res} = await getTeacherDetail({userId:this.data.postData.userId})
    if(code === 200){
      this.setData({
        teacherInfo:res
      })
    }
    },
    // 获取教师课程列表
    async teacherCourseList() {
     const {code, data:res} =  await getSeriesList(this.data.postData)
     if(code === 200){
      this.setData({
        teacherCourseList:res.list
      })
     } 
    },
    // 查看系列课程详情
    seeRecommedDetail(e:any){
      console.log(111);
      
      const {courseserialid,courseserialname} = e.currentTarget.dataset
        wx.navigateTo({
          url:`/recommendCourse_package/pages/courseDetail/courseDetail?courseserialid=${courseserialid}&courseserialname=${courseserialname}`
        })
      }
  }
})